% create matrix describing all possible states  - combinations of education and age
%------------------------------------------------
% columns are: age, completed education, in school, current education (if
% in school)
states=NaN(55,4);
i=1;

% when can still be in school
for a=13:18
    emax=min(a-6,12);
    for e=[7:emax emax]
            states(i,1)=a;
            states(i,2)=e;
            i=i+1;
    end
    states(i-1,3)=1; 
end

% when can still be in school
for a=19:22
    emax=min(a-6,13);
    for e=[7:emax]
        states(i,1)=a;
        states(i,2)=e;
        i=i+1;
    end
end

inschool=(states(:,3)==1);
states(inschool==1,4)=states(inschool==1,2)+1;
